#include "manano_common.h"

#include "mdtx-online/indicator/indicator_type_ma.h"
#include "mdtx-online/indicator/indicator_type_ma_rsi.h"
namespace indi = mdtx::online::indicator;

using rsi_tma = unary1<indi::rsi_ma<indi::tma>>;
using rsi_wma = unary1<indi::rsi_ma<indi::wma>>;
using rsi_hma = unary1<indi::rsi_ma<indi::hma>>;
using rsi = unary1<indi::rsi>;
using tsi = unary1<indi::tsi>;
using rsi_dema = unary1<indi::rsi_ma<indi::dema>>;
using rsi_tema = unary1<indi::rsi_ma<indi::tema>>;
using rsi_t3ma = unary1<indi::rsi_ma<indi::t3ma>>;
using rsi_ewma = unary1<indi::rsi_ma<indi::ewma>>;
using rsi_zlema = unary1<indi::rsi_ma<indi::zlema>>;

using rsi_vwma = binary1<indi::rsi_wma<indi::vwma>>;
using rsi_evwma = binary1<indi::rsi_wma<indi::evwma>>;

using rsi_tmosc = unary1<indi::rsi_maosc<indi::tma>>;
using rsi_wmosc = unary1<indi::rsi_maosc<indi::wma>>;
using rsi_hmosc = unary1<indi::rsi_maosc<indi::hma>>;
using rsi_emosc = unary1<indi::rsi_maosc<indi::ema>>;
using rsi_demosc = unary1<indi::rsi_maosc<indi::dema>>;
using rsi_temosc = unary1<indi::rsi_maosc<indi::tema>>;
using rsi_t3mosc = unary1<indi::rsi_maosc<indi::t3ma>>;
using rsi_ewmosc = unary1<indi::rsi_maosc<indi::ewma>>;
using rsi_zlemosc = unary1<indi::rsi_maosc<indi::zlema>>;

using rsi_vwmosc = binary1<indi::rsi_wmaosc<indi::vwma>>;
using rsi_evwmowc = binary1<indi::rsi_wmaosc<indi::evwma>>;

void bind_indi_ma_rsi(py::module &m)
{
    auto mod = m.def_submodule("rsi", "Relative strength indicators");
    {
        auto v = py::class_<rsi_tma>(mod, "tma")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_tma::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_tma::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of TMA
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_wma>(mod, "wma")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_wma::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_wma::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of WMA
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_hma>(mod, "hma")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_hma::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_hma::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of HMA
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi>(mod, "rsi")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi::run, py::arg("x"), "Run calc")
                     .def("run", &rsi::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of EMA
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<tsi>(mod, "tsi")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &tsi::run, py::arg("x"), "Run calc")
                     .def("run", &tsi::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    TSI (true strength indicator)
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_dema>(mod, "dema")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_dema::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_dema::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of DEMA
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_tema>(mod, "tema")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_tema::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_tema::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of TEMA
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_t3ma>(mod, "t3ma")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_t3ma::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_t3ma::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of T3MA
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_ewma>(mod, "ewma")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_ewma::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_ewma::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of EWMA
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_zlema>(mod, "zlema")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_zlema::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_zlema::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of ZLEMA
                    Args:
                        period (int) : MA period)mydoc";
    }

    {
        auto v = py::class_<rsi_vwma>(mod, "vwma")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_vwma::run, py::arg("x"), py::arg("w"), "Run calc")
                     .def("run", &rsi_vwma::run2, py::arg("x"), py::arg("w"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of VWMA (volume weighted moving average)
                    Args:
                        period (int) : MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_evwma>(mod, "evwma")
                     .def(py::init<int>(), py::arg("period"))
                     .def("run", &rsi_evwma::run, "Run calc")
                     .def("run", &rsi_evwma::run2, "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of EVWMA (elastic volume weighted moving average)
                    Args:
                        period (int) : MA period)mydoc";
    }

    {
        auto v = py::class_<rsi_tmosc>(mod, "tma_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_tmosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_tmosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of TMA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_wmosc>(mod, "wma_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_wmosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_wmosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of WMA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_hmosc>(mod, "hma_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_hmosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_hmosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of HMA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_emosc>(mod, "ema_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_emosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_emosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of EMA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_demosc>(mod, "dema_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_demosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_demosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of DEMA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_temosc>(mod, "tema_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_temosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_temosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of TEMA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_t3mosc>(mod, "t3ma_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_t3mosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_t3mosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of T3MA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_ewmosc>(mod, "ewma_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_ewmosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_ewmosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of EWMA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_zlemosc>(mod, "zlema_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_zlemosc::run, py::arg("x"), "Run calc")
                     .def("run", &rsi_zlemosc::run2, py::arg("x"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of ZLEMA oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }

    {
        auto v = py::class_<rsi_vwmosc>(mod, "vwma_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_vwmosc::run, py::arg("x"), py::arg("w"), "Run calc")
                     .def("run", &rsi_vwmosc::run2, py::arg("x"), py::arg("w"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of VWMA (volume weighted moving average) oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }
    {
        auto v = py::class_<rsi_evwmowc>(mod, "evwma_osc")
                     .def(py::init<int, int, int>(), py::arg("fast_period"), py::arg("slow_period"), py::arg("sig_period"))
                     .def("run", &rsi_evwmowc::run, py::arg("x"), py::arg("w"), "Run calc")
                     .def("run", &rsi_evwmowc::run2, py::arg("x"), py::arg("w"), "Run batch calc");
        v.doc() = R"mydoc(
                    RSI of EVWMA (elastic volume weighted moving average) oscillator
                    Args:
                        fast_period (int) : fast MA period
                        slow_period (int) : slow MA period
                        sig_period (int) : signal MA period)mydoc";
    }

}
